﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="mtorderlist.aspx.cs" Inherits="Html5.mtorderlist" %>


<%@ Register Src="~/baseControl.ascx" TagPrefix="uc1" TagName="baseControl" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <title><%= SectionProxyData.GetSetValue(3) %></title>

    <link type="text/css" rel="stylesheet" href="/css/style.css" />
    <link type="text/css" rel="stylesheet" href="/css/page.css" />
    <link type="text/css" rel="stylesheet" href="../css/shopcenter.css?v=2017030604" />
    <link href="../css/sweetalert.css" rel="stylesheet" />

    <script type="text/javascript" src="/javascript/jquery.js"></script>

    <style type="text/css">
        .bom_menu .icon-order {
            background-image: url(/images/ico_b_order_cur.png);
        }

        #page_title .top_shop {
            background: url(/images/shop_top_search.png) no-repeat;
            height: 32px;
            width: 32px;
            background-size: 100% 100%;
            margin-top: 5px;
        }

                 #page_title .orderreflush {
            background: url(/images/orderreflush.png) no-repeat;
            height: 32px;
            width: 32px;
            background-size: 100% 100%;
            margin-top: 5px;
        }
    </style>


</head>
<body>
    <div class="page">

        <div id="page_title">
            <a href="index.aspx" id="back" class=" top_left" data-ajax="false"><span style="padding-left: 15px; width: 50px; position: absolute; top: -10px; font-size: 14px;">返回</span></a>
            <h1>美团订单</h1>
            <a id="togourl" class="top_shop top_right" href="javascript:" onclick="$('#searchbox').toggle()"></a>

             <a id="togourl2" class="orderreflush top_right" style="right:50px;" href="javascript:" onclick="location.reload();"></a>

        </div>

        <div class="container ">

            <div id="searchbox" style="display: none;">

                <ul class="my_order_list">
                    <li>
                        <div class="order-tit">
                            <span class="time"><strong>单号/电话</strong>
                                <input name="tbuserName" type="text" runat="server" id="tbkey" class="w_txt" placeholder="请输入单号或者手机号" />
                            </span>
                        </div>

                        <div class="order-tit" style="border-bottom: none; padding: 0;">
                            <span class="time"><strong>订单状态</strong>
                                <select id="ddlstate" runat="server"></select>
                            </span>
                        </div>


                    </li>
                </ul>

                <div class="order-tit">
                    <div class="view_back_con">
                        <input type="submit" value="搜索" onclick="searchorder()" class="view_back_btn" data-ajax="false" />
                    </div>
                </div>
            </div>


            <ul class="my_order_list">
                <asp:Repeater runat="server" ID="rptorder">
                    <ItemTemplate>
                        <li>

                            <div class="order-tit">
                                <span class="time"><%# Eval("OrderDateTime")%></span>
                                <span class="state" style="padding-left: 0; margin-left: 5px;" id="order_<%# Eval("orderid") %>"><%# Convert.ToInt32(Eval("IsShopSet")) == 0 ? "" :"已发"  %>



                                    <input type="button" id="btsubmit" value="发送" onclick="sendEleOrder2system('<%# Eval("orderid") %>    ')" class="send2sym_btn" data-ajax="false" style="<%# Convert.ToInt32(Eval("IsShopSet")) == 0? "": "display:none;"  %>" />

                                </span>
                            </div>

                            <a href="showeleorder.aspx?id=<%# Eval("orderid") %>" data-ajax="false">
                                <div class="order-info">
                                    <p class="f14">订单编号：<span class="red"><%# Eval("orderid") %></span></p>
                                    <p class="grey">总金额：￥<%# Eval("OrderSums")%></p>
                                    <p class="grey">配送费：￥<%# Eval("shopdiscountmoney")%></p>
                                    <p class="grey"><span style="color: blue;">地址：</span><%# Eval("AddressText")%></p>
                                    <p class="grey"><span style="color: red;">约定：</span><%# Eval("SendTime")%></p>
                                </div>
                            </a>
                        </li>
                    </ItemTemplate>
                </asp:Repeater>
            </ul>

            <div class="con-btn" id="pages" runat="server" style="display: ;">
            </div>
        </div>
    </div>

    <uc1:baseControl runat="server" ID="baseControl" />

</body>
</html>

<script src="../javascript/sweetalert.min.js"></script>
<script src="../javascript/jCommon.js"></script>

<script type="text/javascript">

    function searchorder() {
        var url = "eleorderlist.aspx?a=1";
        var tbkey = $.trim($("#tbkey").val());
        if (tbkey.length > 0) {
            url += "&key=" + tbkey;
        }

        var ddlstate = $.trim($("#ddlstate").val());
        if (ddlstate != "-1") {
            url += "&state=" + ddlstate;
        }

        window.location = url;

    }

    $(document).ready(function () {
        var tbkey = request("key")
        if (tbkey.length > 0) {
            $("#tbkey").val(tbkey);
            $("#searchbox").show();
        }
        var state = request("state")
        if (state.length > 0) {
            $("#ddlstate").val(state);
            $("#searchbox").show();
        }

    });

    ///发送饿了么订单到系统
    function sendEleOrder2system(orderid) {

        WeUI.showLoading();

        jQuery.ajax(
        {
            type: "get",
            url: "/ajaxHandler.ashx",
            data: 'method=sendEleOrder2system&orderid=' + orderid + "&t=" + new Date().getTime(),
            success: function (msg) {
              
                WeUI.hideLoadingslowly();

                var json = JSON.parse(msg);
                if (json.state ==1) {
                    WeUI.toastSuccess();
                    $("#order_"+orderid).html("已发");
                }
                else
                {
                    sweetAlert("", json.msg, "warning");
                }


            }
        });
    }



</script>
